/**!
 * 金融平台
 * author: wangkai;
 */
var userguid = $.cookie('the_userid');
(function(win, $) {

    var $iconNode = $('.ewb-icon-node');

    // 高亮显示
    var Highlight = function(index) {
        var _this = $iconNode.eq(index);
        $iconNode.find('.ewb-popup').stop().fadeOut('fast');
        _this.siblings().removeClass('current');
        _this.addClass('current');
        _this.find('.ewb-popup').stop().fadeIn('fast');
    };

    // 默认显示第一个
    Highlight(0);

    $iconNode.hover(function() {
        var _index = $(this).index();
        Highlight(_index);
    });
	
	var ParasJsona = {
		ValidateData:"",
		paras:{

		  }
	};
	
	$.ajax({
		url:Util.AjaxRUrl+"getfinancecount",
		type:"post",
		data:JSON.stringify(ParasJsona),
		contentType: "application/json;charset=utf-8",
		dataType:"json",
		success:function(msg){
			//console.log(msg);
			$("#rzxqcount").html(msg.UserArea.finance.xqcount);
			$("#rzjgcount").html(msg.UserArea.finance.jgcount);
		}
	});
	
	var ParasJson = {
		ValidateData:"",
		paras:{
		   userguid: userguid,
		   type:"",
		   keywords:"",
		   pageIndex:"1",
		   pageSize:"5"
		  }
	};

	$.ajax({
		url:Util.AjaxRUrl+"gethfzxqallList",
		type:"post",
		data:JSON.stringify(ParasJson),
		contentType: "application/json;charset=utf-8",
		dataType:"json",
		success:function(msg){
			var M = Mustache;
			for(var i=0;i< msg.UserArea.rzxqList.length;i++){
				if(msg.UserArea.rzxqList[i].qyname.length>10){
					msg.UserArea.rzxqList[i].qyname = msg.UserArea.rzxqList[i].qyname.substring(0,10)+"...";
				}
			}
			$("#rzxqinfolist").html(M.render($("#rzxqinfolist-tmpl").html(), { items: msg.UserArea.rzxqList }));
		}
	});
	
	$.ajax({
		url:Util.AjaxRUrl+"gethfzxqsummary",
		type:"post",
		data:JSON.stringify(ParasJson),
		contentType: "application/json;charset=utf-8",
		dataType:"json",
		success:function(msg){
			$("#summary").html(msg.UserArea.summary);
		}
	});
}(this, jQuery));



function tzxqfb(){
	if(userguid){
		$.ajax({
			url: Util.AjaxRUrl + 'userInfo',
			type: "post",
			dataType: "json",
			async: false, //用户类型需先确定

			data: {
				param: '{userGuid:"' + userguid + '"}'
			},
			success: function(data) {
				//console.log(data);
				window.location.href="/postDemand.html";
			}
		});
	}else{
		alert("请登录!");
		//login();
	}
}
